<?php

class m131116_071904_oak extends CDbMigration
{
    public function safeUp()
    {
        $sql = 'ALTER TABLE `{{user}}` ADD `search_purpose_id` tinyint AFTER `avatar_id`;

                ALTER TABLE `{{user}}` ADD INDEX idx_search_purpose_id (`search_purpose_id`);
                ALTER TABLE `{{user}}` ADD FOREIGN KEY (`search_purpose_id`) REFERENCES `{{search_purpose}}` (`id`);';

        $this->execute($sql);
    }

    public function safeDown()
    {
        return false;
    }
}